package com.dsj.gxrd.modules.controller.book;

import java.util.List;

import com.dsj.gxrd.modules.book.domain.dto.RdBookDto;
import com.dsj.gxrd.modules.book.domain.query.RdBookQuery;
import com.dsj.gxrd.modules.book.domain.vo.RdBookCockpit;
import com.dsj.gxrd.modules.book.service.IRdBookService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 *
 * @author ruoyi
 * @date 2023-09-11
 */
@Api(tags = "书香人大推荐书籍")
@RestController
@RequestMapping("/book")
public class RdBookController extends BaseController
{
    @Autowired
    private IRdBookService rdBookService;

    @GetMapping("/list")
    public TableDataInfo list(RdBookQuery rdBook)
    {
        startPage();
        List<RdBookDto> list = rdBookService.selectRdBookList(rdBook);
        return getDataTable(list);
    }


    @GetMapping(value = "/{rdBookId}")
    public AjaxResult getInfo(@PathVariable("rdBookId") Long rdBookId)
    {
        return success(rdBookService.selectRdBookByRdBookId(rdBookId));
    }

    @GetMapping(value = "/cockpit")
    public AjaxResult cockpit()
    {
        List<RdBookCockpit>list=rdBookService.cockpit();
        return success(list);
    }

}
